<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class db {

    var $host = NULL;
    var $username = NULL;
    var $password = NULL;
    var $dbmaster = NULL;
    var $dbslave = NULL;
    var $db = NULL;

    function database($host, $username, $password, $database) {
        $this->host = $host;
        $this->username = $username;
        $this->password = $password;
        $this->database = $database;

        $this->db = mysql_connect($this->host, $this->username, $this->password) or die("COULD NOT CONNECT");
        mysql_select_db($database);
    }

    function query($query) {
        $sql = mysql_query($query, $this->db)or die(mysql_error());
        return $sql;
        mysql_free_result($sql);
    }

    function fetch($query) {
        $sql = mysql_fetch_array(mysql_query($query, $this->db));
        return $sql;
        mysql_free_result($sql);
    }
    
    function close()
    {
        mysql_close($this->db);
    }

}

?>
